/**
 * StackVectorTest.java
 * @author Vinicio Gomez
 * Pruebas unitarias a StackVector.java
 */
package stack.pruebas;

import static org.junit.Assert.*;
import org.junit.Test;
import stack.*;



/**
 * @author Vinicio Gomez
 *
 */
public class StackVectorTest {
	
	private StackVector <String> stack = new StackVector <String>();

	/**
	 * Test method for {@link StackVector#push(java.lang.Object)}.
	 */
	@Test
	public void testPush() {
		stack.push("push");
		assertEquals("push",stack.peek());
		assertFalse(stack.empty());
		assertTrue(stack.size()==1);
	}

	/**
	 * Test method for {@link StackVector#pop()}.
	 */
	@Test
	public void testPop() {
		stack.push("pop");
		assertEquals("pop", stack.pop());
		assertTrue(stack.empty());
		assertTrue(stack.size()==0);
	}

	/**
	 * Test method for {@link StackVector#peek()}.
	 */
	@Test
	public void testPeek() {
		stack.push("push");
		assertTrue(stack.size()==1);
		assertEquals("push",stack.peek());
		assertTrue(stack.size()==1);
	}

	/**
	 * Test method for {@link StackVector#empty()}.
	 */
	@Test
	public void testEmpty() {
		assertTrue(stack.empty());
		stack.push("empty");
		assertFalse(stack.empty());
	}

	/**
	 * Test method for {@link StackVector#size()}.
	 */
	@Test
	public void testSize() {
		assertTrue(stack.size()==0);
		stack.push("empty");
		assertTrue(stack.size()==1);
		stack.push("empty");
		assertTrue(stack.size()==2);
		stack.push("empty");
		assertTrue(stack.size()==3);
		stack.push("empty");
		assertTrue(stack.size()==4);
		stack.push("empty");
		assertTrue(stack.size()==5);
		stack.push("empty");
		assertTrue(stack.size()==6);
		stack.push("empty");
		assertTrue(stack.size()==7);
		stack.push("empty");
		assertTrue(stack.size()==8);
		stack.push("empty");
		assertTrue(stack.size()==9);
		stack.push("empty");
		assertTrue(stack.size()==10);
		stack.push("empty");
		assertTrue(stack.size()==11);
		stack.push("empty");
		assertTrue(stack.size()==12);
		stack.pop();
		assertTrue(stack.size()==11);
		stack.pop();
		assertTrue(stack.size()==10);
		
	}

}
